package com.ym.domain.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ym.domain.dao.CusCustomerService;
import com.ym.domain.mapper.CusCustomerMapper;
import com.ym.domain.model.CusCustomer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class CusCustomerServiceImpl extends ServiceImpl<CusCustomerMapper, CusCustomer> implements CusCustomerService {

    @Override
    public CusCustomer getByPhoneNumber(String phoneNumber) {
        QueryWrapper<CusCustomer> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(CusCustomer::getPhoneNumber, phoneNumber);
        return this.getOne(queryWrapper);
    }

    @Override
    public CusCustomer getByEmail(String email) {
        QueryWrapper<CusCustomer> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(CusCustomer::getEmail, email);
        return this.getOne(queryWrapper);
    }

}
